package com.alibaba.citrus.cr.platform.enhance.facade.service.scitem.group;

import javax.annotation.Resource;

import com.alibaba.citrus.cr.platform.enhance.functions.item.group.ScItemGroupEntity;
import com.alibaba.citrus.cr.platform.enhance.repository.ScItemGroupRepository;
import com.alibaba.lattice2.epoch.sdk.model.Result;

import com.epoch.app.crplatformenhance.api.group.scitemgroupwrite.service.ScItemGroupWriteService;
import com.epoch.app.crplatformenhance.sdo.ScItemGroupSDO;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;

/**
 * @author zls
 * @description: TODO
 * @date 2021/9/7 15:30
 */
@Primary
@Service
public class ScItemGroupWriteServiceImpl implements ScItemGroupWriteService {

    @Resource
    ScItemGroupRepository scItemGroupRepository;

    @Override
    public Result<String> createScItemGroup(ScItemGroupSDO scItemGroupSDO) {
        ScItemGroupEntity scItemGroupEntity = ScItemGroupEntity.of(scItemGroupSDO);
        String id = scItemGroupEntity.doCreate();
        return Result.success(id);
    }

    @Override
    public Result<Boolean> editScItemGroup(ScItemGroupSDO scItemGroupSDO) {
        ScItemGroupEntity scItemGroupEntity = ScItemGroupEntity.of(scItemGroupSDO);
        return Result.success(scItemGroupEntity.doEdit());
    }

}
